<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- Copyright 2016 TensorFlow authors.</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- you may not use this file except in compliance with the License.</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- You may obtain a copy of the License at</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">--     http://www.apache.org/licenses/LICENSE-2.0</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Unless required by applicable law or agreed to in writing, software</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- See the License for the specific language governing permissions and</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- limitations under the License.</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
</span><span id="line-16"></span><span class="hs-pragma">{-# LANGUAGE OverloadedStrings #-}</span><span>
</span><span id="line-17"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-18"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">TensorFlow.ControlFlow</span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-comment">-- * Dependencies</span></span><span>
</span><span id="line-22"></span><span>      </span><span class="annot"><a href="TensorFlow.ControlFlow.html#withControlDependencies"><span class="hs-identifier">withControlDependencies</span></a></span><span>
</span><span id="line-23"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.ControlFlow.html#group"><span class="hs-identifier">group</span></a></span><span>
</span><span id="line-24"></span><span>      </span><span class="annot"><span class="hs-comment">-- * Operations</span></span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.ControlFlow.html#noOp"><span class="hs-identifier">noOp</span></a></span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="TensorFlow.BuildOp.html"><span class="hs-identifier">TensorFlow.BuildOp</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="TensorFlow.Build.html"><span class="hs-identifier">TensorFlow.Build</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="TensorFlow.Nodes.html"><span class="hs-identifier">TensorFlow.Nodes</span></a></span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-comment">-- | Modify a 'Build' action, such that all new ops rendered in it will depend</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- on the nodes in the first argument.</span><span>
</span><span id="line-34"></span><span id="local-6989586621679167447"><span id="local-6989586621679167448"><span id="local-6989586621679167449"><span class="annot"><a href="TensorFlow.ControlFlow.html#withControlDependencies"><span class="hs-identifier hs-type">withControlDependencies</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Build.html#MonadBuild"><span class="hs-identifier hs-type">MonadBuild</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167449"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Nodes.html#Nodes"><span class="hs-identifier hs-type">Nodes</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167448"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679167448"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679167449"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167447"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679167449"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167447"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-35"></span><span id="withControlDependencies"><span class="annot"><span class="annottext">withControlDependencies :: t -&gt; m a -&gt; m a
</span><a href="TensorFlow.ControlFlow.html#withControlDependencies"><span class="hs-identifier hs-var hs-var">withControlDependencies</span></a></span></span><span> </span><span id="local-6989586621679167437"><span class="annot"><span class="annottext">deps :: t
</span><a href="#local-6989586621679167437"><span class="hs-identifier hs-var">deps</span></a></span></span><span> </span><span id="local-6989586621679167436"><span class="annot"><span class="annottext">act :: m a
</span><a href="#local-6989586621679167436"><span class="hs-identifier hs-var">act</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-36"></span><span>    </span><span id="local-6989586621679167435"><span class="annot"><span class="annottext">Set NodeName
</span><a href="#local-6989586621679167435"><span class="hs-identifier hs-var">nodes</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Build (Set NodeName) -&gt; m (Set NodeName)
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Build a -&gt; m a
</span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a></span><span> </span><span class="annot"><span class="annottext">(Build (Set NodeName) -&gt; m (Set NodeName))
-&gt; Build (Set NodeName) -&gt; m (Set NodeName)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">t -&gt; Build (Set NodeName)
forall t. Nodes t =&gt; t -&gt; Build (Set NodeName)
</span><a href="TensorFlow.Nodes.html#getNodes"><span class="hs-identifier hs-var">getNodes</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679167437"><span class="hs-identifier hs-var">deps</span></a></span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><span class="annottext">Set NodeName -&gt; m a -&gt; m a
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Set NodeName -&gt; m a -&gt; m a
</span><a href="TensorFlow.Build.html#withNodeDependencies"><span class="hs-identifier hs-var">withNodeDependencies</span></a></span><span> </span><span class="annot"><span class="annottext">Set NodeName
</span><a href="#local-6989586621679167435"><span class="hs-identifier hs-var">nodes</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679167436"><span class="hs-identifier hs-var">act</span></a></span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-comment">-- TODO(judahjacobson): Reimplement withDependencies.</span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-comment">-- | Create an op that groups multiple operations.</span><span>
</span><span id="line-42"></span><span class="hs-comment">--</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- When this op finishes, all ops in the input @n@ have finished.  This op has</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- no output.</span><span>
</span><span id="line-45"></span><span id="local-6989586621679167430"><span id="local-6989586621679167431"><span class="annot"><a href="TensorFlow.ControlFlow.html#group"><span class="hs-identifier hs-type">group</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Build.html#MonadBuild"><span class="hs-identifier hs-type">MonadBuild</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167431"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Nodes.html#Nodes"><span class="hs-identifier hs-type">Nodes</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167430"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679167430"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679167431"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Output.html#ControlNode"><span class="hs-identifier hs-type">ControlNode</span></a></span></span></span><span>
</span><span id="line-46"></span><span id="group"><span class="annot"><span class="annottext">group :: t -&gt; m ControlNode
</span><a href="TensorFlow.ControlFlow.html#group"><span class="hs-identifier hs-var hs-var">group</span></a></span></span><span> </span><span id="local-6989586621679167429"><span class="annot"><span class="annottext">deps :: t
</span><a href="#local-6989586621679167429"><span class="hs-identifier hs-var">deps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; m ControlNode -&gt; m ControlNode
forall (m :: * -&gt; *) t a.
(MonadBuild m, Nodes t) =&gt;
t -&gt; m a -&gt; m a
</span><a href="TensorFlow.ControlFlow.html#withControlDependencies"><span class="hs-identifier hs-var">withControlDependencies</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679167429"><span class="hs-identifier hs-var">deps</span></a></span><span> </span><span class="annot"><span class="annottext">m ControlNode
forall (m :: * -&gt; *). MonadBuild m =&gt; m ControlNode
</span><a href="TensorFlow.ControlFlow.html#noOp"><span class="hs-identifier hs-var">noOp</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="hs-comment">-- | Does nothing.  Only useful as a placeholder for control edges.</span><span>
</span><span id="line-49"></span><span id="local-6989586621679167446"><span class="annot"><a href="TensorFlow.ControlFlow.html#noOp"><span class="hs-identifier hs-type">noOp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Build.html#MonadBuild"><span class="hs-identifier hs-type">MonadBuild</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679167446"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679167446"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Output.html#ControlNode"><span class="hs-identifier hs-type">ControlNode</span></a></span></span><span>
</span><span id="line-50"></span><span id="noOp"><span class="annot"><span class="annottext">noOp :: m ControlNode
</span><a href="TensorFlow.ControlFlow.html#noOp"><span class="hs-identifier hs-var hs-var">noOp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Build ControlNode -&gt; m ControlNode
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Build a -&gt; m a
</span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a></span><span> </span><span class="annot"><span class="annottext">(Build ControlNode -&gt; m ControlNode)
-&gt; Build ControlNode -&gt; m ControlNode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; OpDef -&gt; Build ControlNode
forall a. BuildResult a =&gt; [Int64] -&gt; OpDef -&gt; Build a
</span><a href="TensorFlow.BuildOp.html#buildOp"><span class="hs-identifier hs-var">buildOp</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(OpDef -&gt; Build ControlNode) -&gt; OpDef -&gt; Build ControlNode
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpType -&gt; OpDef
</span><a href="TensorFlow.Build.html#opDef"><span class="hs-identifier hs-var">opDef</span></a></span><span> </span><span class="annot"><span class="hs-string">&quot;NoOp&quot;</span></span><span>
</span><span id="line-51"></span></pre></body></html>